﻿using System.IO;

namespace KinonekoSoftware.Platform.Core
{
    public class ApplicationInformation
    {
        
        /// <summary>
        /// 
        /// </summary>
        internal string DataFolder => GetDir(Path.Combine(GlobalFolder, "Data"));

        internal string JuXiaoYou4Folder => GetDir(Path.Combine(DataFolder, "JuXiaoYou4"));
        
        /// <summary>
        /// 
        /// </summary>
        public string ApplicationFolder { get; init; }
        
        /// <summary>
        /// C:\Users\xxxx\Documents\JuXiaoYou\
        /// </summary>
        public string GlobalFolder { get; init; }
        
        /// <summary>
        /// 是否启用日志
        /// </summary>
        public bool EnableLogger { get; init; }

        /// <summary>
        /// 
        /// </summary>
        public string SettingFolder => GetDir( Path.Combine(GlobalFolder, "Settings"));
        
        /// <summary>
        /// 水印目录
        /// </summary>
        public string WatermarkFolder => GetDir(Path.Combine(JuXiaoYou4Folder, "Watermark"));
        
        /// <summary>
        /// 
        /// </summary>
        public string LogsFolder => GetDir( Path.Combine(GlobalFolder, "Logs"));
        
        /// <summary>
        /// 
        /// </summary>
        public string FeedbackFolder => GetDir( Path.Combine(GlobalFolder, "Feedbacks"));
        
        /// <summary>
        /// 
        /// </summary>
        public string CacheFolder => GetDir( Path.Combine(GlobalFolder, "Caches"));

        public static string GetDir(string dir)
        {
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            return dir;
        }
    }
}